<template>
	<view class="mainpadding2">
		<view class="flexcenter" v-if="!list.total">
			<view class="placeholderimage"></view>
		</view>
		<view class="mainpadding_top ffffff radius" v-if="list.data.length" v-for="(item,index) in list.data"
			:key="item.id">
			<view class="flexbetween">
				<view class="flexleft">
					<image src="@/static/login/logo.png" mode="" class="listheadplimg"></image>
					<view class="xiaohei margin_left1">{{item.custom.username}}</view>
				</view>
				<view class="xiaohui">{{item.createtime_text}}</view>
			</view>
			<view class="hei_text bold main_size margin_top">{{item.content}}</view>
			<view class="flexleft">
				<view class="itemimgBox flexcenter margin_top" v-for="(ite,ind) in item.images_text" :key="ite" @click="lbtpriview(ind,item.images_text)">
					<image class="listleftimg radius" :src="ite" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	const httpRequest = require("@/commonFun/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				listid:""
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.init()
		},
		methods: {
			lbtpriview(index, arr) {
				var i = arr; //获取当前页面的轮播图数据
				//uniapp预览轮播图
				uni.previewImage({
					current: index, //预览图片的下标
					urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			init(isPage, page) {
				let _this = this;
				httpRequest.request('/customapi/goods/goodsCommentIndex', 'GET', {
					page: page || 1,
					limit: _this.limit,
					goods_id: this.listid
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							_this.list = resList
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>

</style>
